{include file="header.html"}
<div id="page_main" class="main-right">
  <div id="rightTop">
    <p>{$lang.theme_setting}</p>
    <ul class="subnav">
      <!--{if $smarty.get.client eq 'wap'}-->
      <li><a class="btn1" href="{url route='theme/index'}">{$lang.pc_theme}</a></li>
      <li><span>{$lang.wap_theme}</span></li>
      <!--{else}-->
      <li><span>{$lang.pc_theme}</span></li>
      <li><a class="btn1" href="{url route='theme/index' client='wap'}">{$lang.wap_theme}</a></li>
      <!--{/if}-->
    </ul>
  </div>
  <div class="info">
    <ul id="rightCon" class="page-theme">
      <h3> {$lang.current_theme} : <em>{$cur_template_name}&nbsp;&nbsp;{$cur_style_name}</em> </h3>
      <!--{foreach from=$templates key=template_name item=styles}--> 
      <!--{foreach from=$styles item=style_name}-->
      <li>
        <div class="title_name">{$template_name}&nbsp;{$style_name}</div>
        <div class="templet_style"><img width="115" src="{$webroot}/templates/mall/{$template_name}/styles/{$style_name}/preview.jpg" onclick="preview_theme('{$template_name}', '{$style_name}','{$smarty.get.client}');" /></div>
        <div class="templet_btn"> 
          <!--{if ($cur_template_name neq $template_name) or ($cur_style_name neq $style_name)}-->
          <input type="submit" value="{$lang.use}" confirm="{$lang.set_theme_warning}" uri="{url route='theme/set' template_name=$template_name style_name=$style_name client=$smarty.get.client}" class="formbtn J_AjaxRequest" />
          &nbsp;&nbsp;
          <input type="button" value="{$lang.preview}" onclick="preview_theme('{$template_name}', '{$style_name}');" class="formbtn" />
          <!--{else}-->
          <input type="button" value="{$lang.go_index}" onclick="go_index('{$smarty.get.client}')" class="formbtn" />
          <!--{/if}--> 
        </div>
      </li>
      <!--{/foreach}--> 
      <!--{/foreach}-->
    </ul>
    <form id="preview_form" method="POST" action="{url route='theme/preview'}" target="_blank">
      <input type="hidden" name="template_name" id="template_name" />
      <input type="hidden" name="style_name" id="style_name" />
      <input type="hidden" name="client" id="client" />
    </form>
    <form id="go_index" method="GET" action="{$app->params['frontendUrl']}" target="_blank">
    </form>
    <form id="go_wapindex" method="GET" action="{$app->params['mobileUrl']}" target="_blank">
    </form>
  </div>
</div>
<script type="text/javascript">
var template_name = '{$cur_template_name}';
var style_name = '{$cur_style_name}';
var client = '{$smarty.get.client}' ? '{$smarty.get.client}' : '';
function use_theme(template, style){
    if (template != template_name) {
		layer.confirm(lang.set_theme_warning,{ icon: 3, title:lang.notice},function(index){
			  layer.close(index);
			  window.location.href = url(['theme/set', { template_name:template, style_name:style, client:client}]);
			  return false;	
		  },function(index){
			  layer.close(index);
			  return false;
		});
  } 
}
function preview_theme(template, style,client){
    $('#template_name').val(template);
    $('#style_name').val(style);
	  $('#client').val(client);	
    $('#preview_form').submit();
}
function go_index(client){
    $('#go_'+client+'index').submit();
}
</script> 
{include file="footer.html"} 